﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Model;
using BLL;
namespace UI
{
    public partial class 系统修改 : Form
    {
        public 系统修改()
        {
            InitializeComponent();
        }

        private void btnAdd_Click(object sender, EventArgs e)
        {
            string NewPwd = this.txtNewMiMa.Text;
            string YuanMima = this.txtYuanMiMa.Text;
            if (Admins.UserPwd == YuanMima&&YuanMima!="")
            {
                if (NewPwd != YuanMima&&NewPwd!="")
                {
                    Admins.UserCompellation = this.txtZhenShiName.Text;
                    Admins.UserPwd = NewPwd;
                    int count = 系统设置BLL.Upd();
                    if (count>0)
                    {
                        MessageBox.Show("修改成功");
                        new 系统设置().Show();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("修改失败");
                    }
                }
                else
                {
                    MessageBox.Show("新密码不能与原密码一致");
                }
            }
            else
            {
                MessageBox.Show("原密码不正确");
            }
        }

        private void 修改操作员_Load(object sender, EventArgs e)
        {
            this.txtID.Text = Admins.UserID.ToString();
            
            this.txtZhenShiName.Text = Admins.UserCompellation;
        }
    }
}
